﻿document.writeln("<style type=\"text\/css\" title=\"\">");
document.writeln("");
document.writeln("\/*弹出日历*\/");
document.writeln("\/* The main calendar widget.  DIV containing a table. *\/");
document.writeln(".calendar { position: relative; display: none; border: 1px solid #000; font-size: 11px; color: #000; cursor: default; background: #E3EBF6;font-family: tahoma,verdana,sans-serif;}");
document.writeln(".calendar table { border-top: 1px solid #fff;border-right: 1px solid #fff;border-bottom: 1px solid #fff; border-left: 1px solid #fff; font-size: 11px;color: #000;cursor: default;background: #E3EBF6;font-family: tahoma,verdana,sans-serif;}");
document.writeln("\/* Header part -- contains navigation buttons and day names. *\/");
document.writeln(".calendar .button {   text-align: center; padding: 1px;border-top: 1px solid #fff;border-right: 1px solid #fff;border-bottom: 1px solid #fff; border-left: 1px solid #fff; font-weight:bold;}\/* \"<<\", \"<\", \">\", \">>\" buttons have this class *\/");
document.writeln(".calendar thead .title {font-weight: bold;padding: 1px;border: 1px solid #fff;background: #99B2D3;color: #fff;text-align: center;");
document.writeln("} \/* This holds the current \"month, year\" *\/");
document.writeln(".calendar thead .headrow { }\/* Row <TR> containing navigation buttons *\/");
document.writeln(".calendar thead .daynames { }\/* Row <TR> containing the day names *\/");
document.writeln(".calendar thead .name { border-bottom: 1px solid #fff; padding: 2px;text-align: center;background: #CBD7E6;}\/* Cells <TD> containing the day names *\/");
document.writeln(".calendar thead .weekend { color: #f00;}\/* How a weekend day name shows in header *\/");
document.writeln(".calendar thead .hilite { border-top: 2px solid #fff;border-right: 2px solid #fff;border-bottom: 2px solid #fff;border-left: 2px solid #fff; padding: 0px;background: #ffffff;}\/* How do the buttons in header appear when hover *\/");
document.writeln(".calendar thead .active { padding: 2px 0px 0px 2px;border-top: 1px solid #fff;border-right: 1px solid #fff;border-bottom: 1px solid #fff; border-left: 1px solid #fff;background: #b8c0c4;}\/* Active (pressed) buttons in header *\/");
document.writeln("\/* The body part -- contains all the days in month. *\/");
document.writeln(".calendar tbody .day { width: 2em;text-align: right;padding: 2px 4px 2px 2px;}\/* Cells <TD> containing month days dates *\/");
document.writeln(".calendar table .wn {padding: 2px 3px 2px 2px;border-right: 1px solid #fff;background: #CBD7E6;}");
document.writeln(".calendar tbody .rowhilite td {background: #d8e4e0;}");
document.writeln(".calendar tbody .rowhilite td.wn {background: #c8d4d0;}");
document.writeln(".calendar tbody td.hilite {padding: 1px 3px 1px 1px;border: 1px solid;border-color: #fff #fff #fff #fff;} \/* Hovered cells <TD> *\/");
document.writeln(".calendar tbody td.active { padding: 2px 2px 0px 2px; border: 1px solid; border-color: #fff #fff #fff #fff;}\/* Active (pressed) cells <TD> *\/");
document.writeln(".calendar tbody td.selected { font-weight: bold;padding: 2px 2px 0px 2px;border: 1px solid;border-color: #fff #fff #fff #fff; background: #d8e0e4;}\/* Cell showing selected date *\/");
document.writeln(".calendar tbody td.weekend { color: #f00;} \/* Cells showing weekend days *\/");
document.writeln(".calendar tbody td.today { ont-weight: bold;color: #00f;}\/* Cell showing today date *\/");
document.writeln(".calendar tbody .disabled { color: #999; }");
document.writeln(".calendar tbody .emptycell {visibility: hidden;} \/* Empty cells (the best is to hide them) *\/");
document.writeln(".calendar tbody .emptyrow { display: none;}\/* Empty row (some months need less than 6 rows) *\/");
document.writeln("\/* The footer part -- status bar and \"Close\" button *\/");
document.writeln(".calendar tfoot .footrow { }\/* The <TR> in footer (only one right now) *\/");
document.writeln(".calendar tfoot .ttip { background: #CBD7E6;padding: 1px;border: 1px solid #fff; background: #99B2D3;color: #fff;text-align: center;}\/* Tooltip (status bar) cell <TD> *\/");
document.writeln(".calendar tfoot .hilite {border-top: 1px solid #fff;border-right: 1px solid #fff;border-bottom: 1px solid #fff;border-left: 1px solid #fff; padding: 1px;background: #d8e0e4;} \/* Hover style for buttons in footer *\/");
document.writeln(".calendar tfoot .active { padding: 2px 0px 0px 2px;border-top: 1px solid #fff;border-right: 1px solid #fff;border-bottom: 1px solid #fff; border-left: 1px solid #fff;}\/* Active (pressed) style for buttons in footer *\/");
document.writeln("\/* Combo boxes (menus that display months\/years for direct selection) *\/");
document.writeln(".combo {position: absolute;display: none;width: 4em;top: 0px;left: 0px;cursor: default;border-top: 1px solid #fff;border-right: 1px solid #fff;border-bottom: 1px solid #fff;border-left: 1px solid #fff;background: #d8e0e4;font-size: smaller;padding: 1px;}");
document.writeln(".combo .label {text-align: center;padding:1px;}");
document.writeln(".combo .active {background: #E3EBF6;padding: 0px;border-top: 1px solid #fff;border-right: 1px solid #fff;border-bottom: 1px solid #fff;border-left: 1px solid #fff;}");
document.writeln(".combo .hilite {background: #048;color: #aef;}");
document.writeln("");
document.writeln("<\/style>");

document.writeln("<script type=\"text\/javascript\" >");
document.writeln("\/*  Copyright Mihai Bazon, 2002, 2003  |  http:\/\/students.infoiasi.ro\/~mishoo");
document.writeln(" * ---------------------------------------------------------------------------");
document.writeln(" *");
document.writeln(" * The DHTML Calendar, version 0.9.3 \"It\'s still alive & keeps rocking\"");
document.writeln(" *");
document.writeln(" * Details and latest version at:");
document.writeln(" * http:\/\/students.infoiasi.ro\/~mishoo\/site\/calendar.epl");
document.writeln(" *");
document.writeln(" * Feel free to use this script under the terms of the GNU Lesser General");
document.writeln(" * Public License, as long as you do not remove or alter this notice.");
document.writeln(" *\/");
document.writeln("");
document.writeln("\/\/ $Id: calendar.js,v 1.11 2003\/07\/08 18:51:41 mishoo Exp $");
document.writeln("");
document.writeln("\/** The Calendar object constructor. *\/");
document.writeln("var Calendar = function (mondayFirst, dateStr, onSelected, onClose) {");
document.writeln("	\/\/ member variables");
document.writeln("	this.activeDiv = null;");
document.writeln("	this.currentDateEl = null;");
document.writeln("	this.checkDisabled = null;");
document.writeln("	this.timeout = null;");
document.writeln("	this.onSelected = onSelected || null;");
document.writeln("	this.onClose = onClose || null;");
document.writeln("	this.dragging = false;");
document.writeln("	this.hidden = false;");
document.writeln("	this.minYear = 1970;");
document.writeln("	this.maxYear = 2050;");
document.writeln("	this.dateFormat = Calendar._TT[\"DEF_DATE_FORMAT\"];");
document.writeln("	this.ttDateFormat = Calendar._TT[\"TT_DATE_FORMAT\"];");
document.writeln("	this.isPopup = true;");
document.writeln("	this.weekNumbers = true;");
document.writeln("	this.mondayFirst = mondayFirst;");
document.writeln("	this.dateStr = dateStr;");
document.writeln("	this.ar_days = null;");
document.writeln("	\/\/ HTML elements");
document.writeln("	this.table = null;");
document.writeln("	this.element = null;");
document.writeln("	this.tbody = null;");
document.writeln("	this.firstdayname = null;");
document.writeln("	\/\/ Combo boxes");
document.writeln("	this.monthsCombo = null;");
document.writeln("	this.yearsCombo = null;");
document.writeln("	this.hilitedMonth = null;");
document.writeln("	this.activeMonth = null;");
document.writeln("	this.hilitedYear = null;");
document.writeln("	this.activeYear = null;");
document.writeln("	\/\/ Information");
document.writeln("	this.dateClicked = false;");
document.writeln("");
document.writeln("	\/\/ one-time initializations");
document.writeln("	if (!Calendar._DN3) {");
document.writeln("		\/\/ table of short day names");
document.writeln("		var ar = new Array();");
document.writeln("		for (var i = 8; i > 0;) {");
document.writeln("			ar[--i] = Calendar._DN[i].substr(0, 3);");
document.writeln("		}");
document.writeln("		Calendar._DN3 = ar;");
document.writeln("		\/\/ table of short month names");
document.writeln("		ar = new Array();");
document.writeln("		for (var i = 12; i > 0;) {");
document.writeln("			ar[--i] = Calendar._MN[i].substr(0, 3);");
document.writeln("		}");
document.writeln("		Calendar._MN3 = ar;");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/\/ ** constants");
document.writeln("");
document.writeln("\/\/\/ \"static\", needed for event handlers.");
document.writeln("Calendar._C = null;");
document.writeln("");
document.writeln("\/\/\/ detect a special case of \"web browser\"");
document.writeln("Calendar.is_ie = ( \/msie\/i.test(navigator.userAgent) &&");
document.writeln("		   !\/opera\/i.test(navigator.userAgent) );");
document.writeln("");
document.writeln("\/\/ short day names array (initialized at first constructor call)");
document.writeln("Calendar._DN3 = null;");
document.writeln("");
document.writeln("\/\/ short month names array (initialized at first constructor call)");
document.writeln("Calendar._MN3 = null;");
document.writeln("");
document.writeln("\/\/ BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate");
document.writeln("\/\/        library, at some point.");
document.writeln("");
document.writeln("Calendar.getAbsolutePos = function(el) {");
document.writeln("	var r = { x: el.offsetLeft, y: el.offsetTop };");
document.writeln("	if (el.offsetParent) {");
document.writeln("		var tmp = Calendar.getAbsolutePos(el.offsetParent);");
document.writeln("		r.x += tmp.x;");
document.writeln("		r.y += tmp.y;");
document.writeln("	}");
document.writeln("	return r;");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.isRelated = function (el, evt) {");
document.writeln("	var related = evt.relatedTarget;");
document.writeln("	if (!related) {");
document.writeln("		var type = evt.type;");
document.writeln("		if (type == \"mouseover\") {");
document.writeln("			related = evt.fromElement;");
document.writeln("		} else if (type == \"mouseout\") {");
document.writeln("			related = evt.toElement;");
document.writeln("		}");
document.writeln("	}");
document.writeln("	while (related) {");
document.writeln("		if (related == el) {");
document.writeln("			return true;");
document.writeln("		}");
document.writeln("		related = related.parentNode;");
document.writeln("	}");
document.writeln("	return false;");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.removeClass = function(el, className) {");
document.writeln("	if (!(el && el.className)) {");
document.writeln("		return;");
document.writeln("	}");
document.writeln("	var cls = el.className.split(\" \");");
document.writeln("	var ar = new Array();");
document.writeln("	for (var i = cls.length; i > 0;) {");
document.writeln("		if (cls[--i] != className) {");
document.writeln("			ar[ar.length] = cls[i];");
document.writeln("		}");
document.writeln("	}");
document.writeln("	el.className = ar.join(\" \");");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.addClass = function(el, className) {");
document.writeln("	Calendar.removeClass(el, className);");
document.writeln("	el.className += \" \" + className;");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.getElement = function(ev) {");
document.writeln("	if (Calendar.is_ie) {");
document.writeln("		return window.event.srcElement;");
document.writeln("	} else {");
document.writeln("		return ev.currentTarget;");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.getTargetElement = function(ev) {");
document.writeln("	if (Calendar.is_ie) {");
document.writeln("		return window.event.srcElement;");
document.writeln("	} else {");
document.writeln("		return ev.target;");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.stopEvent = function(ev) {");
document.writeln("	if (Calendar.is_ie) {");
document.writeln("		window.event.cancelBubble = true;");
document.writeln("		window.event.returnValue = false;");
document.writeln("	} else {");
document.writeln("		ev.preventDefault();");
document.writeln("		ev.stopPropagation();");
document.writeln("	}");
document.writeln("	return false;");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.addEvent = function(el, evname, func) {");
document.writeln("	if (el.attachEvent) { \/\/ IE");
document.writeln("		el.attachEvent(\"on\" + evname, func);");
document.writeln("	} else if (el.addEventListener) { \/\/ Gecko \/ W3C");
document.writeln("		el.addEventListener(evname, func, true);");
document.writeln("	} else { \/\/ Opera (or old browsers)");
document.writeln("		el[\"on\" + evname] = func;");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.removeEvent = function(el, evname, func) {");
document.writeln("	if (el.detachEvent) { \/\/ IE");
document.writeln("		el.detachEvent(\"on\" + evname, func);");
document.writeln("	} else if (el.removeEventListener) { \/\/ Gecko \/ W3C");
document.writeln("		el.removeEventListener(evname, func, true);");
document.writeln("	} else { \/\/ Opera (or old browsers)");
document.writeln("		el[\"on\" + evname] = null;");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.createElement = function(type, parent) {");
document.writeln("	var el = null;");
document.writeln("	if (document.createElementNS) {");
document.writeln("		\/\/ use the XHTML namespace; IE won\'t normally get here unless");
document.writeln("		\/\/ _they_ \"fix\" the DOM2 implementation.");
document.writeln("		el = document.createElementNS(\"http:\/\/www.w3.org\/1999\/xhtml\", type);");
document.writeln("	} else {");
document.writeln("		el = document.createElement(type);");
document.writeln("	}");
document.writeln("	if (typeof parent != \"undefined\") {");
document.writeln("		parent.appendChild(el);");
document.writeln("	}");
document.writeln("	return el;");
document.writeln("};");
document.writeln("");
document.writeln("\/\/ END: UTILITY FUNCTIONS");
document.writeln("");
document.writeln("\/\/ BEGIN: CALENDAR STATIC FUNCTIONS");
document.writeln("");
document.writeln("\/** Internal -- adds a set of events to make some element behave like a button. *\/");
document.writeln("Calendar._add_evs = function(el) {");
document.writeln("	with (Calendar) {");
document.writeln("		addEvent(el, \"mouseover\", dayMouseOver);");
document.writeln("		addEvent(el, \"mousedown\", dayMouseDown);");
document.writeln("		addEvent(el, \"mouseout\", dayMouseOut);");
document.writeln("		if (is_ie) {");
document.writeln("			addEvent(el, \"dblclick\", dayMouseDblClick);");
document.writeln("			el.setAttribute(\"unselectable\", true);");
document.writeln("		}");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.findMonth = function(el) {");
document.writeln("	if (typeof el.month != \"undefined\") {");
document.writeln("		return el;");
document.writeln("	} else if (typeof el.parentNode.month != \"undefined\") {");
document.writeln("		return el.parentNode;");
document.writeln("	}");
document.writeln("	return null;");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.findYear = function(el) {");
document.writeln("	if (typeof el.year != \"undefined\") {");
document.writeln("		return el;");
document.writeln("	} else if (typeof el.parentNode.year != \"undefined\") {");
document.writeln("		return el.parentNode;");
document.writeln("	}");
document.writeln("	return null;");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.showMonthsCombo = function () {");
document.writeln("	var cal = Calendar._C;");
document.writeln("	if (!cal) {");
document.writeln("		return false;");
document.writeln("	}");
document.writeln("	var cal = cal;");
document.writeln("	var cd = cal.activeDiv;");
document.writeln("	var mc = cal.monthsCombo;");
document.writeln("	if (cal.hilitedMonth) {");
document.writeln("		Calendar.removeClass(cal.hilitedMonth, \"hilite\");");
document.writeln("	}");
document.writeln("	if (cal.activeMonth) {");
document.writeln("		Calendar.removeClass(cal.activeMonth, \"active\");");
document.writeln("	}");
document.writeln("	var mon = cal.monthsCombo.getElementsByTagName(\"div\")[cal.date.getMonth()];");
document.writeln("	Calendar.addClass(mon, \"active\");");
document.writeln("	cal.activeMonth = mon;");
document.writeln("	mc.style.left = cd.offsetLeft + \"px\";");
document.writeln("	mc.style.top = (cd.offsetTop + cd.offsetHeight) + \"px\";");
document.writeln("	mc.style.display = \"block\";");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.showYearsCombo = function (fwd) {");
document.writeln("	var cal = Calendar._C;");
document.writeln("	if (!cal) {");
document.writeln("		return false;");
document.writeln("	}");
document.writeln("	var cal = cal;");
document.writeln("	var cd = cal.activeDiv;");
document.writeln("	var yc = cal.yearsCombo;");
document.writeln("	if (cal.hilitedYear) {");
document.writeln("		Calendar.removeClass(cal.hilitedYear, \"hilite\");");
document.writeln("	}");
document.writeln("	if (cal.activeYear) {");
document.writeln("		Calendar.removeClass(cal.activeYear, \"active\");");
document.writeln("	}");
document.writeln("	cal.activeYear = null;");
document.writeln("	var Y = cal.date.getFullYear() + (fwd ? 1 : -1);");
document.writeln("	var yr = yc.firstChild;");
document.writeln("	var show = false;");
document.writeln("	for (var i = 12; i > 0; --i) {");
document.writeln("		if (Y >= cal.minYear && Y <= cal.maxYear) {");
document.writeln("			yr.firstChild.data = Y;");
document.writeln("			yr.year = Y;");
document.writeln("			yr.style.display = \"block\";");
document.writeln("			show = true;");
document.writeln("		} else {");
document.writeln("			yr.style.display = \"none\";");
document.writeln("		}");
document.writeln("		yr = yr.nextSibling;");
document.writeln("		Y += fwd ? 2 : -2;");
document.writeln("	}");
document.writeln("	if (show) {");
document.writeln("		yc.style.left = cd.offsetLeft + \"px\";");
document.writeln("		yc.style.top = (cd.offsetTop + cd.offsetHeight) + \"px\";");
document.writeln("		yc.style.display = \"block\";");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/\/ event handlers");
document.writeln("");
document.writeln("Calendar.tableMouseUp = function(ev) {");
document.writeln("	var cal = Calendar._C;");
document.writeln("	if (!cal) {");
document.writeln("		return false;");
document.writeln("	}");
document.writeln("	if (cal.timeout) {");
document.writeln("		clearTimeout(cal.timeout);");
document.writeln("	}");
document.writeln("	var el = cal.activeDiv;");
document.writeln("	if (!el) {");
document.writeln("		return false;");
document.writeln("	}");
document.writeln("	var target = Calendar.getTargetElement(ev);");
document.writeln("	Calendar.removeClass(el, \"active\");");
document.writeln("	if (target == el || target.parentNode == el) {");
document.writeln("		Calendar.cellClick(el);");
document.writeln("	}");
document.writeln("	var mon = Calendar.findMonth(target);");
document.writeln("	var date = null;");
document.writeln("	if (mon) {");
document.writeln("		date = new Date(cal.date);");
document.writeln("		if (mon.month != date.getMonth()) {");
document.writeln("			date.setMonth(mon.month);");
document.writeln("			cal.setDate(date);");
document.writeln("			cal.dateClicked = false;");
document.writeln("			cal.callHandler();");
document.writeln("		}");
document.writeln("	} else {");
document.writeln("		var year = Calendar.findYear(target);");
document.writeln("		if (year) {");
document.writeln("			date = new Date(cal.date);");
document.writeln("			if (year.year != date.getFullYear()) {");
document.writeln("				date.setFullYear(year.year);");
document.writeln("				cal.setDate(date);");
document.writeln("				cal.dateClicked = false;");
document.writeln("				cal.callHandler();");
document.writeln("			}");
document.writeln("		}");
document.writeln("	}");
document.writeln("	with (Calendar) {");
document.writeln("		removeEvent(document, \"mouseup\", tableMouseUp);");
document.writeln("		removeEvent(document, \"mouseover\", tableMouseOver);");
document.writeln("		removeEvent(document, \"mousemove\", tableMouseOver);");
document.writeln("		cal._hideCombos();");
document.writeln("		_C = null;");
document.writeln("		return stopEvent(ev);");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.tableMouseOver = function (ev) {");
document.writeln("	var cal = Calendar._C;");
document.writeln("	if (!cal) {");
document.writeln("		return;");
document.writeln("	}");
document.writeln("	var el = cal.activeDiv;");
document.writeln("	var target = Calendar.getTargetElement(ev);");
document.writeln("	if (target == el || target.parentNode == el) {");
document.writeln("		Calendar.addClass(el, \"hilite active\");");
document.writeln("		Calendar.addClass(el.parentNode, \"rowhilite\");");
document.writeln("	} else {");
document.writeln("		Calendar.removeClass(el, \"active\");");
document.writeln("		Calendar.removeClass(el, \"hilite\");");
document.writeln("		Calendar.removeClass(el.parentNode, \"rowhilite\");");
document.writeln("	}");
document.writeln("	var mon = Calendar.findMonth(target);");
document.writeln("	if (mon) {");
document.writeln("		if (mon.month != cal.date.getMonth()) {");
document.writeln("			if (cal.hilitedMonth) {");
document.writeln("				Calendar.removeClass(cal.hilitedMonth, \"hilite\");");
document.writeln("			}");
document.writeln("			Calendar.addClass(mon, \"hilite\");");
document.writeln("			cal.hilitedMonth = mon;");
document.writeln("		} else if (cal.hilitedMonth) {");
document.writeln("			Calendar.removeClass(cal.hilitedMonth, \"hilite\");");
document.writeln("		}");
document.writeln("	} else {");
document.writeln("		var year = Calendar.findYear(target);");
document.writeln("		if (year) {");
document.writeln("			if (year.year != cal.date.getFullYear()) {");
document.writeln("				if (cal.hilitedYear) {");
document.writeln("					Calendar.removeClass(cal.hilitedYear, \"hilite\");");
document.writeln("				}");
document.writeln("				Calendar.addClass(year, \"hilite\");");
document.writeln("				cal.hilitedYear = year;");
document.writeln("			} else if (cal.hilitedYear) {");
document.writeln("				Calendar.removeClass(cal.hilitedYear, \"hilite\");");
document.writeln("			}");
document.writeln("		}");
document.writeln("	}");
document.writeln("	return Calendar.stopEvent(ev);");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.tableMouseDown = function (ev) {");
document.writeln("	if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) {");
document.writeln("		return Calendar.stopEvent(ev);");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.calDragIt = function (ev) {");
document.writeln("	var cal = Calendar._C;");
document.writeln("	if (!(cal && cal.dragging)) {");
document.writeln("		return false;");
document.writeln("	}");
document.writeln("	var posX;");
document.writeln("	var posY;");
document.writeln("	if (Calendar.is_ie) {");
document.writeln("		posY = window.event.clientY + document.body.scrollTop;");
document.writeln("		posX = window.event.clientX + document.body.scrollLeft;");
document.writeln("	} else {");
document.writeln("		posX = ev.pageX;");
document.writeln("		posY = ev.pageY;");
document.writeln("	}");
document.writeln("	cal.hideShowCovered();");
document.writeln("	var st = cal.element.style;");
document.writeln("	st.left = (posX - cal.xOffs) + \"px\";");
document.writeln("	st.top = (posY - cal.yOffs) + \"px\";");
document.writeln("	return Calendar.stopEvent(ev);");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.calDragEnd = function (ev) {");
document.writeln("	var cal = Calendar._C;");
document.writeln("	if (!cal) {");
document.writeln("		return false;");
document.writeln("	}");
document.writeln("	cal.dragging = false;");
document.writeln("	with (Calendar) {");
document.writeln("		removeEvent(document, \"mousemove\", calDragIt);");
document.writeln("		removeEvent(document, \"mouseover\", stopEvent);");
document.writeln("		removeEvent(document, \"mouseup\", calDragEnd);");
document.writeln("		tableMouseUp(ev);");
document.writeln("	}");
document.writeln("	cal.hideShowCovered();");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.dayMouseDown = function(ev) {");
document.writeln("	var el = Calendar.getElement(ev);");
document.writeln("	if (el.disabled) {");
document.writeln("		return false;");
document.writeln("	}");
document.writeln("	var cal = el.calendar;");
document.writeln("	cal.activeDiv = el;");
document.writeln("	Calendar._C = cal;");
document.writeln("	if (el.navtype != 300) with (Calendar) {");
document.writeln("		addClass(el, \"hilite active\");");
document.writeln("		addEvent(document, \"mouseover\", tableMouseOver);");
document.writeln("		addEvent(document, \"mousemove\", tableMouseOver);");
document.writeln("		addEvent(document, \"mouseup\", tableMouseUp);");
document.writeln("	} else if (cal.isPopup) {");
document.writeln("		cal._dragStart(ev);");
document.writeln("	}");
document.writeln("	if (el.navtype == -1 || el.navtype == 1) {");
document.writeln("		cal.timeout = setTimeout(\"Calendar.showMonthsCombo()\", 250);");
document.writeln("	} else if (el.navtype == -2 || el.navtype == 2) {");
document.writeln("		cal.timeout = setTimeout((el.navtype > 0) ? \"Calendar.showYearsCombo(true)\" : \"Calendar.showYearsCombo(false)\", 250);");
document.writeln("	} else {");
document.writeln("		cal.timeout = null;");
document.writeln("	}");
document.writeln("	return Calendar.stopEvent(ev);");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.dayMouseDblClick = function(ev) {");
document.writeln("	Calendar.cellClick(Calendar.getElement(ev));");
document.writeln("	if (Calendar.is_ie) {");
document.writeln("		document.selection.empty();");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.dayMouseOver = function(ev) {");
document.writeln("	var el = Calendar.getElement(ev);");
document.writeln("	if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) {");
document.writeln("		return false;");
document.writeln("	}");
document.writeln("	if (el.ttip) {");
document.writeln("		if (el.ttip.substr(0, 1) == \"_\") {");
document.writeln("			var date = null;");
document.writeln("			with (el.calendar.date) {");
document.writeln("				date = new Date(getFullYear(), getMonth(), el.caldate);");
document.writeln("			}");
document.writeln("			el.ttip = date.print(el.calendar.ttDateFormat) + el.ttip.substr(1);");
document.writeln("		}");
document.writeln("		el.calendar.tooltips.firstChild.data = el.ttip;");
document.writeln("	}");
document.writeln("	if (el.navtype != 300) {");
document.writeln("		Calendar.addClass(el, \"hilite\");");
document.writeln("		if (el.caldate) {");
document.writeln("			Calendar.addClass(el.parentNode, \"rowhilite\");");
document.writeln("		}");
document.writeln("	}");
document.writeln("	return Calendar.stopEvent(ev);");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.dayMouseOut = function(ev) {");
document.writeln("	with (Calendar) {");
document.writeln("		var el = getElement(ev);");
document.writeln("		if (isRelated(el, ev) || _C || el.disabled) {");
document.writeln("			return false;");
document.writeln("		}");
document.writeln("		removeClass(el, \"hilite\");");
document.writeln("		if (el.caldate) {");
document.writeln("			removeClass(el.parentNode, \"rowhilite\");");
document.writeln("		}");
document.writeln("		el.calendar.tooltips.firstChild.data = _TT[\"SEL_DATE\"];");
document.writeln("		return stopEvent(ev);");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/**");
document.writeln(" *  A generic \"click\" handler :) handles all types of buttons defined in this");
document.writeln(" *  calendar.");
document.writeln(" *\/");
document.writeln("Calendar.cellClick = function(el) {");
document.writeln("	var cal = el.calendar;");
document.writeln("	var closing = false;");
document.writeln("	var newdate = false;");
document.writeln("	var date = null;");
document.writeln("	if (typeof el.navtype == \"undefined\") {");
document.writeln("		Calendar.removeClass(cal.currentDateEl, \"selected\");");
document.writeln("		Calendar.addClass(el, \"selected\");");
document.writeln("		closing = (cal.currentDateEl == el);");
document.writeln("		if (!closing) {");
document.writeln("			cal.currentDateEl = el;");
document.writeln("		}");
document.writeln("		cal.date.setDate(el.caldate);");
document.writeln("		date = cal.date;");
document.writeln("		newdate = true;");
document.writeln("		\/\/ a date was clicked");
document.writeln("		cal.dateClicked = true;");
document.writeln("	} else {");
document.writeln("		if (el.navtype == 200) {");
document.writeln("			Calendar.removeClass(el, \"hilite\");");
document.writeln("			cal.callCloseHandler();");
document.writeln("			return;");
document.writeln("		}");
document.writeln("		date = (el.navtype == 0) ? new Date() : new Date(cal.date);");
document.writeln("		\/\/ unless \"today\" was clicked, we assume no date was clicked so");
document.writeln("		\/\/ the selected handler will know not to close the calenar when");
document.writeln("		\/\/ in single-click mode.");
document.writeln("		cal.dateClicked = (el.navtype == 0);");
document.writeln("		var year = date.getFullYear();");
document.writeln("		var mon = date.getMonth();");
document.writeln("		function setMonth(m) {");
document.writeln("			var day = date.getDate();");
document.writeln("			var max = date.getMonthDays(m);");
document.writeln("			if (day > max) {");
document.writeln("				date.setDate(max);");
document.writeln("			}");
document.writeln("			date.setMonth(m);");
document.writeln("		};");
document.writeln("		switch (el.navtype) {");
document.writeln("		    case -2:");
document.writeln("			if (year > cal.minYear) {");
document.writeln("				date.setFullYear(year - 1);");
document.writeln("			}");
document.writeln("			break;");
document.writeln("		    case -1:");
document.writeln("			if (mon > 0) {");
document.writeln("				setMonth(mon - 1);");
document.writeln("			} else if (year-- > cal.minYear) {");
document.writeln("				date.setFullYear(year);");
document.writeln("				setMonth(11);");
document.writeln("			}");
document.writeln("			break;");
document.writeln("		    case 1:");
document.writeln("			if (mon < 11) {");
document.writeln("				setMonth(mon + 1);");
document.writeln("			} else if (year < cal.maxYear) {");
document.writeln("				date.setFullYear(year + 1);");
document.writeln("				setMonth(0);");
document.writeln("			}");
document.writeln("			break;");
document.writeln("		    case 2:");
document.writeln("			if (year < cal.maxYear) {");
document.writeln("				date.setFullYear(year + 1);");
document.writeln("			}");
document.writeln("			break;");
document.writeln("		    case 100:");
document.writeln("			cal.setMondayFirst(!cal.mondayFirst);");
document.writeln("			return;");
document.writeln("		    case 0:");
document.writeln("			\/\/ TODAY will bring us here");
document.writeln("			if ((typeof cal.checkDisabled == \"function\") && cal.checkDisabled(date)) {");
document.writeln("				\/\/ remember, \"date\" was previously set to new");
document.writeln("				\/\/ Date() if TODAY was clicked; thus, it");
document.writeln("				\/\/ contains today date.");
document.writeln("				return false;");
document.writeln("			}");
document.writeln("			break;");
document.writeln("		}");
document.writeln("		if (!date.equalsTo(cal.date)) {");
document.writeln("			cal.setDate(date);");
document.writeln("			newdate = true;");
document.writeln("		}");
document.writeln("	}");
document.writeln("	if (newdate) {");
document.writeln("		cal.callHandler();");
document.writeln("	}");
document.writeln("	if (closing) {");
document.writeln("		Calendar.removeClass(el, \"hilite\");");
document.writeln("		cal.callCloseHandler();");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/\/ END: CALENDAR STATIC FUNCTIONS");
document.writeln("");
document.writeln("\/\/ BEGIN: CALENDAR OBJECT FUNCTIONS");
document.writeln("");
document.writeln("\/**");
document.writeln(" *  This function creates the calendar inside the given parent.  If _par is");
document.writeln(" *  null than it creates a popup calendar inside the BODY element.  If _par is");
document.writeln(" *  an element, be it BODY, then it creates a non-popup calendar (still");
document.writeln(" *  hidden).  Some properties need to be set before calling this function.");
document.writeln(" *\/");
document.writeln("Calendar.prototype.create = function (_par) {");
document.writeln("	var parent = null;");
document.writeln("	if (! _par) {");
document.writeln("		\/\/ default parent is the document body, in which case we create");
document.writeln("		\/\/ a popup calendar.");
document.writeln("		parent = document.getElementsByTagName(\"body\")[0];");
document.writeln("		this.isPopup = true;");
document.writeln("	} else {");
document.writeln("		parent = _par;");
document.writeln("		this.isPopup = false;");
document.writeln("	}");
document.writeln("	this.date = this.dateStr ? new Date(this.dateStr) : new Date();");
document.writeln("");
document.writeln("	var table = Calendar.createElement(\"table\");");
document.writeln("	this.table = table;");
document.writeln("	table.cellSpacing = 0;");
document.writeln("	table.cellPadding = 0;");
document.writeln("	table.calendar = this;");
document.writeln("	Calendar.addEvent(table, \"mousedown\", Calendar.tableMouseDown);");
document.writeln("");
document.writeln("	var div = Calendar.createElement(\"div\");");
document.writeln("	this.element = div;");
document.writeln("	div.className = \"calendar\";");
document.writeln("	if (this.isPopup) {");
document.writeln("		div.style.position = \"absolute\";");
document.writeln("		div.style.display = \"none\";");
document.writeln("	}");
document.writeln("	div.appendChild(table);");
document.writeln("");
document.writeln("	var thead = Calendar.createElement(\"thead\", table);");
document.writeln("	var cell = null;");
document.writeln("	var row = null;");
document.writeln("");
document.writeln("	var cal = this;");
document.writeln("	var hh = function (text, cs, navtype) {");
document.writeln("		cell = Calendar.createElement(\"td\", row);");
document.writeln("		cell.colSpan = cs;");
document.writeln("		cell.className = \"button\";");
document.writeln("		Calendar._add_evs(cell);");
document.writeln("		cell.calendar = cal;");
document.writeln("		cell.navtype = navtype;");
document.writeln("		if (text.substr(0, 1) != \"&\") {");
document.writeln("			cell.appendChild(document.createTextNode(text));");
document.writeln("		}");
document.writeln("		else {");
document.writeln("			\/\/ FIXME: dirty hack for entities");
document.writeln("			cell.innerHTML = text;");
document.writeln("		}");
document.writeln("		return cell;");
document.writeln("	};");
document.writeln("");
document.writeln("	row = Calendar.createElement(\"tr\", thead);");
document.writeln("	var title_length = 6;");
document.writeln("	(this.isPopup) && --title_length;");
document.writeln("	(this.weekNumbers) && ++title_length;");
document.writeln("");
document.writeln("	hh(\"-\", 1, 100).ttip = Calendar._TT[\"TOGGLE\"];");
document.writeln("	this.title = hh(\"\", title_length, 300);");
document.writeln("	this.title.className = \"title\";");
document.writeln("	if (this.isPopup) {");
document.writeln("		this.title.ttip = Calendar._TT[\"DRAG_TO_MOVE\"];");
document.writeln("		this.title.style.cursor = \"move\";");
document.writeln("		hh(\"&#x00d7;\", 1, 200).ttip = Calendar._TT[\"CLOSE\"];");
document.writeln("	}");
document.writeln("");
document.writeln("	row = Calendar.createElement(\"tr\", thead);");
document.writeln("	row.className = \"headrow\";");
document.writeln("");
document.writeln("	this._nav_py = hh(\"&#x00ab;\", 1, -2);");
document.writeln("	this._nav_py.ttip = Calendar._TT[\"PREV_YEAR\"];");
document.writeln("");
document.writeln("	this._nav_pm = hh(\"&#x2039;\", 1, -1);");
document.writeln("	this._nav_pm.ttip = Calendar._TT[\"PREV_MONTH\"];");
document.writeln("");
document.writeln("	this._nav_now = hh(Calendar._TT[\"TODAY\"], this.weekNumbers ? 4 : 3, 0);");
document.writeln("	this._nav_now.ttip = Calendar._TT[\"GO_TODAY\"];");
document.writeln("");
document.writeln("	this._nav_nm = hh(\"&#x203a;\", 1, 1);");
document.writeln("	this._nav_nm.ttip = Calendar._TT[\"NEXT_MONTH\"];");
document.writeln("");
document.writeln("	this._nav_ny = hh(\"&#x00bb;\", 1, 2);");
document.writeln("	this._nav_ny.ttip = Calendar._TT[\"NEXT_YEAR\"];");
document.writeln("");
document.writeln("	\/\/ day names");
document.writeln("	row = Calendar.createElement(\"tr\", thead);");
document.writeln("	row.className = \"daynames\";");
document.writeln("	if (this.weekNumbers) {");
document.writeln("		cell = Calendar.createElement(\"td\", row);");
document.writeln("		cell.className = \"name wn\";");
document.writeln("		cell.appendChild(document.createTextNode(Calendar._TT[\"WK\"]));");
document.writeln("	}");
document.writeln("	for (var i = 7; i > 0; --i) {");
document.writeln("		cell = Calendar.createElement(\"td\", row);");
document.writeln("		cell.appendChild(document.createTextNode(\"\"));");
document.writeln("		if (!i) {");
document.writeln("			cell.navtype = 100;");
document.writeln("			cell.calendar = this;");
document.writeln("			Calendar._add_evs(cell);");
document.writeln("		}");
document.writeln("	}");
document.writeln("	this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild;");
document.writeln("	this._displayWeekdays();");
document.writeln("");
document.writeln("	var tbody = Calendar.createElement(\"tbody\", table);");
document.writeln("	this.tbody = tbody;");
document.writeln("");
document.writeln("	for (i = 6; i > 0; --i) {");
document.writeln("		row = Calendar.createElement(\"tr\", tbody);");
document.writeln("		if (this.weekNumbers) {");
document.writeln("			cell = Calendar.createElement(\"td\", row);");
document.writeln("			cell.appendChild(document.createTextNode(\"\"));");
document.writeln("		}");
document.writeln("		for (var j = 7; j > 0; --j) {");
document.writeln("			cell = Calendar.createElement(\"td\", row);");
document.writeln("			cell.appendChild(document.createTextNode(\"\"));");
document.writeln("			cell.calendar = this;");
document.writeln("			Calendar._add_evs(cell);");
document.writeln("		}");
document.writeln("	}");
document.writeln("");
document.writeln("	var tfoot = Calendar.createElement(\"tfoot\", table);");
document.writeln("");
document.writeln("	row = Calendar.createElement(\"tr\", tfoot);");
document.writeln("	row.className = \"footrow\";");
document.writeln("");
document.writeln("	cell = hh(Calendar._TT[\"SEL_DATE\"], this.weekNumbers ? 8 : 7, 300);");
document.writeln("	cell.className = \"ttip\";");
document.writeln("	if (this.isPopup) {");
document.writeln("		cell.ttip = Calendar._TT[\"DRAG_TO_MOVE\"];");
document.writeln("		cell.style.cursor = \"move\";");
document.writeln("	}");
document.writeln("	this.tooltips = cell;");
document.writeln("");
document.writeln("	div = Calendar.createElement(\"div\", this.element);");
document.writeln("	this.monthsCombo = div;");
document.writeln("	div.className = \"combo\";");
document.writeln("	for (i = 0; i < Calendar._MN.length; ++i) {");
document.writeln("		var mn = Calendar.createElement(\"div\");");
document.writeln("		mn.className = \"label\";");
document.writeln("		mn.month = i;");
document.writeln("		mn.appendChild(document.createTextNode(Calendar._MN3[i]));");
document.writeln("		div.appendChild(mn);");
document.writeln("	}");
document.writeln("");
document.writeln("	div = Calendar.createElement(\"div\", this.element);");
document.writeln("	this.yearsCombo = div;");
document.writeln("	div.className = \"combo\";");
document.writeln("	for (i = 12; i > 0; --i) {");
document.writeln("		var yr = Calendar.createElement(\"div\");");
document.writeln("		yr.className = \"label\";");
document.writeln("		yr.appendChild(document.createTextNode(\"\"));");
document.writeln("		div.appendChild(yr);");
document.writeln("	}");
document.writeln("");
document.writeln("	this._init(this.mondayFirst, this.date);");
document.writeln("	parent.appendChild(this.element);");
document.writeln("};");
document.writeln("");
document.writeln("\/** keyboard navigation, only for popup calendars *\/");
document.writeln("Calendar._keyEvent = function(ev) {");
document.writeln("	if (!window.calendar) {");
document.writeln("		return false;");
document.writeln("	}");
document.writeln("	(Calendar.is_ie) && (ev = window.event);");
document.writeln("	var cal = window.calendar;");
document.writeln("	var act = (Calendar.is_ie || ev.type == \"keypress\");");
document.writeln("	if (ev.ctrlKey) {");
document.writeln("		switch (ev.keyCode) {");
document.writeln("		    case 37: \/\/ KEY left");
document.writeln("			act && Calendar.cellClick(cal._nav_pm);");
document.writeln("			break;");
document.writeln("		    case 38: \/\/ KEY up");
document.writeln("			act && Calendar.cellClick(cal._nav_py);");
document.writeln("			break;");
document.writeln("		    case 39: \/\/ KEY right");
document.writeln("			act && Calendar.cellClick(cal._nav_nm);");
document.writeln("			break;");
document.writeln("		    case 40: \/\/ KEY down");
document.writeln("			act && Calendar.cellClick(cal._nav_ny);");
document.writeln("			break;");
document.writeln("		    default:");
document.writeln("			return false;");
document.writeln("		}");
document.writeln("	} else switch (ev.keyCode) {");
document.writeln("	    case 32: \/\/ KEY space (now)");
document.writeln("		Calendar.cellClick(cal._nav_now);");
document.writeln("		break;");
document.writeln("	    case 27: \/\/ KEY esc");
document.writeln("		act && cal.hide();");
document.writeln("		break;");
document.writeln("	    case 37: \/\/ KEY left");
document.writeln("	    case 38: \/\/ KEY up");
document.writeln("	    case 39: \/\/ KEY right");
document.writeln("	    case 40: \/\/ KEY down");
document.writeln("		if (act) {");
document.writeln("			var date = cal.date.getDate() - 1;");
document.writeln("			var el = cal.currentDateEl;");
document.writeln("			var ne = null;");
document.writeln("			var prev = (ev.keyCode == 37) || (ev.keyCode == 38);");
document.writeln("			switch (ev.keyCode) {");
document.writeln("			    case 37: \/\/ KEY left");
document.writeln("				(--date >= 0) && (ne = cal.ar_days[date]);");
document.writeln("				break;");
document.writeln("			    case 38: \/\/ KEY up");
document.writeln("				date -= 7;");
document.writeln("				(date >= 0) && (ne = cal.ar_days[date]);");
document.writeln("				break;");
document.writeln("			    case 39: \/\/ KEY right");
document.writeln("				(++date < cal.ar_days.length) && (ne = cal.ar_days[date]);");
document.writeln("				break;");
document.writeln("			    case 40: \/\/ KEY down");
document.writeln("				date += 7;");
document.writeln("				(date < cal.ar_days.length) && (ne = cal.ar_days[date]);");
document.writeln("				break;");
document.writeln("			}");
document.writeln("			if (!ne) {");
document.writeln("				if (prev) {");
document.writeln("					Calendar.cellClick(cal._nav_pm);");
document.writeln("				} else {");
document.writeln("					Calendar.cellClick(cal._nav_nm);");
document.writeln("				}");
document.writeln("				date = (prev) ? cal.date.getMonthDays() : 1;");
document.writeln("				el = cal.currentDateEl;");
document.writeln("				ne = cal.ar_days[date - 1];");
document.writeln("			}");
document.writeln("			Calendar.removeClass(el, \"selected\");");
document.writeln("			Calendar.addClass(ne, \"selected\");");
document.writeln("			cal.date.setDate(ne.caldate);");
document.writeln("			cal.callHandler();");
document.writeln("			cal.currentDateEl = ne;");
document.writeln("		}");
document.writeln("		break;");
document.writeln("	    case 13: \/\/ KEY enter");
document.writeln("		if (act) {");
document.writeln("			cal.callHandler();");
document.writeln("			cal.hide();");
document.writeln("		}");
document.writeln("		break;");
document.writeln("	    default:");
document.writeln("		return false;");
document.writeln("	}");
document.writeln("	return Calendar.stopEvent(ev);");
document.writeln("};");
document.writeln("");
document.writeln("\/**");
document.writeln(" *  (RE)Initializes the calendar to the given date and style (if mondayFirst is");
document.writeln(" *  true it makes Monday the first day of week, otherwise the weeks start on");
document.writeln(" *  Sunday.");
document.writeln(" *\/");
document.writeln("Calendar.prototype._init = function (mondayFirst, date) {");
document.writeln("	var today = new Date();");
document.writeln("	var year = date.getFullYear();");
document.writeln("	if (year < this.minYear) {");
document.writeln("		year = this.minYear;");
document.writeln("		date.setFullYear(year);");
document.writeln("	} else if (year > this.maxYear) {");
document.writeln("		year = this.maxYear;");
document.writeln("		date.setFullYear(year);");
document.writeln("	}");
document.writeln("	this.mondayFirst = mondayFirst;");
document.writeln("	this.date = new Date(date);");
document.writeln("	var month = date.getMonth();");
document.writeln("	var mday = date.getDate();");
document.writeln("	var no_days = date.getMonthDays();");
document.writeln("	date.setDate(1);");
document.writeln("	var wday = date.getDay();");
document.writeln("	var MON = mondayFirst ? 1 : 0;");
document.writeln("	var SAT = mondayFirst ? 5 : 6;");
document.writeln("	var SUN = mondayFirst ? 6 : 0;");
document.writeln("	if (mondayFirst) {");
document.writeln("		wday = (wday > 0) ? (wday - 1) : 6;");
document.writeln("	}");
document.writeln("	var iday = 1;");
document.writeln("	var row = this.tbody.firstChild;");
document.writeln("	var MN = Calendar._MN3[month];");
document.writeln("	var hasToday = ((today.getFullYear() == year) && (today.getMonth() == month));");
document.writeln("	var todayDate = today.getDate();");
document.writeln("	var week_number = date.getWeekNumber();");
document.writeln("	var ar_days = new Array();");
document.writeln("	for (var i = 0; i < 6; ++i) {");
document.writeln("		if (iday > no_days) {");
document.writeln("			row.className = \"emptyrow\";");
document.writeln("			row = row.nextSibling;");
document.writeln("			continue;");
document.writeln("		}");
document.writeln("		var cell = row.firstChild;");
document.writeln("		if (this.weekNumbers) {");
document.writeln("			cell.className = \"day wn\";");
document.writeln("			cell.firstChild.data = week_number;");
document.writeln("			cell = cell.nextSibling;");
document.writeln("		}");
document.writeln("		++week_number;");
document.writeln("		row.className = \"daysrow\";");
document.writeln("		for (var j = 0; j < 7; ++j) {");
document.writeln("			cell.className = \"day\";");
document.writeln("			if ((!i && j < wday) || iday > no_days) {");
document.writeln("				\/\/ cell.className = \"emptycell\";");
document.writeln("				cell.innerHTML = \"&nbsp;\";");
document.writeln("				cell.disabled = true;");
document.writeln("				cell = cell.nextSibling;");
document.writeln("				continue;");
document.writeln("			}");
document.writeln("			cell.disabled = false;");
document.writeln("			cell.firstChild.data = iday;");
document.writeln("			if (typeof this.checkDisabled == \"function\") {");
document.writeln("				date.setDate(iday);");
document.writeln("				if (this.checkDisabled(date)) {");
document.writeln("					cell.className += \" disabled\";");
document.writeln("					cell.disabled = true;");
document.writeln("				}");
document.writeln("			}");
document.writeln("			if (!cell.disabled) {");
document.writeln("				ar_days[ar_days.length] = cell;");
document.writeln("				cell.caldate = iday;");
document.writeln("				cell.ttip = \"_\";");
document.writeln("				if (iday == mday) {");
document.writeln("					cell.className += \" selected\";");
document.writeln("					this.currentDateEl = cell;");
document.writeln("				}");
document.writeln("				if (hasToday && (iday == todayDate)) {");
document.writeln("					cell.className += \" today\";");
document.writeln("					cell.ttip += Calendar._TT[\"PART_TODAY\"];");
document.writeln("				}");
document.writeln("				if (wday == SAT || wday == SUN) {");
document.writeln("					cell.className += \" weekend\";");
document.writeln("				}");
document.writeln("			}");
document.writeln("			++iday;");
document.writeln("			((++wday) ^ 7) || (wday = 0);");
document.writeln("			cell = cell.nextSibling;");
document.writeln("		}");
document.writeln("		row = row.nextSibling;");
document.writeln("	}");
document.writeln("	this.ar_days = ar_days;");
document.writeln("	this.title.firstChild.data = Calendar._MN[month] + \", \" + year;");
document.writeln("	\/\/ PROFILE");
document.writeln("	\/\/ this.tooltips.firstChild.data = \"Generated in \" + ((new Date()) - today) + \" ms\";");
document.writeln("};");
document.writeln("");
document.writeln("\/**");
document.writeln(" *  Calls _init function above for going to a certain date (but only if the");
document.writeln(" *  date is different than the currently selected one).");
document.writeln(" *\/");
document.writeln("Calendar.prototype.setDate = function (date) {");
document.writeln("	if (!date.equalsTo(this.date)) {");
document.writeln("		this._init(this.mondayFirst, date);");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/**");
document.writeln(" *  Refreshes the calendar.  Useful if the \"disabledHandler\" function is");
document.writeln(" *  dynamic, meaning that the list of disabled date can change at runtime.");
document.writeln(" *  Just * call this function if you think that the list of disabled dates");
document.writeln(" *  should * change.");
document.writeln(" *\/");
document.writeln("Calendar.prototype.refresh = function () {");
document.writeln("	this._init(this.mondayFirst, this.date);");
document.writeln("};");
document.writeln("");
document.writeln("\/** Modifies the \"mondayFirst\" parameter (EU\/US style). *\/");
document.writeln("Calendar.prototype.setMondayFirst = function (mondayFirst) {");
document.writeln("	this._init(mondayFirst, this.date);");
document.writeln("	this._displayWeekdays();");
document.writeln("};");
document.writeln("");
document.writeln("\/**");
document.writeln(" *  Allows customization of what dates are enabled.  The \"unaryFunction\"");
document.writeln(" *  parameter must be a function object that receives the date (as a JS Date");
document.writeln(" *  object) and returns a boolean value.  If the returned value is true then");
document.writeln(" *  the passed date will be marked as disabled.");
document.writeln(" *\/");
document.writeln("Calendar.prototype.setDisabledHandler = function (unaryFunction) {");
document.writeln("	this.checkDisabled = unaryFunction;");
document.writeln("};");
document.writeln("");
document.writeln("\/** Customization of allowed year range for the calendar. *\/");
document.writeln("Calendar.prototype.setRange = function (a, z) {");
document.writeln("	this.minYear = a;");
document.writeln("	this.maxYear = z;");
document.writeln("};");
document.writeln("");
document.writeln("\/** Calls the first user handler (selectedHandler). *\/");
document.writeln("Calendar.prototype.callHandler = function () {");
document.writeln("	if (this.onSelected) {");
document.writeln("		this.onSelected(this, this.date.print(this.dateFormat));");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/** Calls the second user handler (closeHandler). *\/");
document.writeln("Calendar.prototype.callCloseHandler = function () {");
document.writeln("	if (this.onClose) {");
document.writeln("		this.onClose(this);");
document.writeln("	}");
document.writeln("	this.hideShowCovered();");
document.writeln("};");
document.writeln("");
document.writeln("\/** Removes the calendar object from the DOM tree and destroys it. *\/");
document.writeln("Calendar.prototype.destroy = function () {");
document.writeln("	var el = this.element.parentNode;");
document.writeln("	el.removeChild(this.element);");
document.writeln("	Calendar._C = null;");
document.writeln("};");
document.writeln("");
document.writeln("\/**");
document.writeln(" *  Moves the calendar element to a different section in the DOM tree (changes");
document.writeln(" *  its parent).");
document.writeln(" *\/");
document.writeln("Calendar.prototype.reparent = function (new_parent) {");
document.writeln("	var el = this.element;");
document.writeln("	el.parentNode.removeChild(el);");
document.writeln("	new_parent.appendChild(el);");
document.writeln("};");
document.writeln("");
document.writeln("\/\/ This gets called when the user presses a mouse button anywhere in the");
document.writeln("\/\/ document, if the calendar is shown.  If the click was outside the open");
document.writeln("\/\/ calendar this function closes it.");
document.writeln("Calendar._checkCalendar = function(ev) {");
document.writeln("	if (!window.calendar) {");
document.writeln("		return false;");
document.writeln("	}");
document.writeln("	var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);");
document.writeln("	for (; el != null && el != calendar.element; el = el.parentNode);");
document.writeln("	if (el == null) {");
document.writeln("		\/\/ calls closeHandler which should hide the calendar.");
document.writeln("		window.calendar.callCloseHandler();");
document.writeln("		return Calendar.stopEvent(ev);");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/** Shows the calendar. *\/");
document.writeln("Calendar.prototype.show = function () {");
document.writeln("	var rows = this.table.getElementsByTagName(\"tr\");");
document.writeln("	for (var i = rows.length; i > 0;) {");
document.writeln("		var row = rows[--i];");
document.writeln("		Calendar.removeClass(row, \"rowhilite\");");
document.writeln("		var cells = row.getElementsByTagName(\"td\");");
document.writeln("		for (var j = cells.length; j > 0;) {");
document.writeln("			var cell = cells[--j];");
document.writeln("			Calendar.removeClass(cell, \"hilite\");");
document.writeln("			Calendar.removeClass(cell, \"active\");");
document.writeln("		}");
document.writeln("	}");
document.writeln("	this.element.style.display = \"block\";");
document.writeln("	this.hidden = false;");
document.writeln("	if (this.isPopup) {");
document.writeln("		window.calendar = this;");
document.writeln("		Calendar.addEvent(document, \"keydown\", Calendar._keyEvent);");
document.writeln("		Calendar.addEvent(document, \"keypress\", Calendar._keyEvent);");
document.writeln("		Calendar.addEvent(document, \"mousedown\", Calendar._checkCalendar);");
document.writeln("	}");
document.writeln("	this.hideShowCovered();");
document.writeln("};");
document.writeln("");
document.writeln("\/**");
document.writeln(" *  Hides the calendar.  Also removes any \"hilite\" from the class of any TD");
document.writeln(" *  element.");
document.writeln(" *\/");
document.writeln("Calendar.prototype.hide = function () {");
document.writeln("	if (this.isPopup) {");
document.writeln("		Calendar.removeEvent(document, \"keydown\", Calendar._keyEvent);");
document.writeln("		Calendar.removeEvent(document, \"keypress\", Calendar._keyEvent);");
document.writeln("		Calendar.removeEvent(document, \"mousedown\", Calendar._checkCalendar);");
document.writeln("	}");
document.writeln("	this.element.style.display = \"none\";");
document.writeln("	this.hidden = true;");
document.writeln("	this.hideShowCovered();");
document.writeln("};");
document.writeln("");
document.writeln("\/**");
document.writeln(" *  Shows the calendar at a given absolute position (beware that, depending on");
document.writeln(" *  the calendar element style -- position property -- this might be relative");
document.writeln(" *  to the parent\'s containing rectangle).");
document.writeln(" *\/");
document.writeln("Calendar.prototype.showAt = function (x, y) {");
document.writeln("	var s = this.element.style;");
document.writeln("	s.left = x + \"px\";");
document.writeln("	s.top = y + \"px\";");
document.writeln("	this.show();");
document.writeln("};");
document.writeln("");
document.writeln("\/** Shows the calendar near a given element. *\/");
document.writeln("Calendar.prototype.showAtElement = function (el, opts) {");
document.writeln("	var p = Calendar.getAbsolutePos(el);");
document.writeln("	if (!opts || typeof opts != \"string\") {");
document.writeln("		this.showAt(p.x, p.y + el.offsetHeight);");
document.writeln("		return true;");
document.writeln("	}");
document.writeln("	this.show();");
document.writeln("	var w = this.element.offsetWidth;");
document.writeln("	var h = this.element.offsetHeight;");
document.writeln("	this.hide();");
document.writeln("	var valign = opts.substr(0, 1);");
document.writeln("	var halign = \"l\";");
document.writeln("	if (opts.length > 1) {");
document.writeln("		halign = opts.substr(1, 1);");
document.writeln("	}");
document.writeln("	\/\/ vertical alignment");
document.writeln("        switch (valign) {");
document.writeln("	    case \"T\": p.y -= h; break;");
document.writeln("	    case \"B\": p.y += el.offsetHeight; break;");
document.writeln("	    case \"C\": p.y += (el.offsetHeight - h) \/ 2; break;");
document.writeln("	    case \"t\": p.y += el.offsetHeight - h; break;");
document.writeln("	    case \"b\": break; \/\/ already there");
document.writeln("        }");
document.writeln("	\/\/ horizontal alignment");
document.writeln("	switch (halign) {");
document.writeln("	    case \"L\": p.x -= w; break;");
document.writeln("	    case \"R\": p.x += el.offsetWidth; break;");
document.writeln("	    case \"C\": p.x += (el.offsetWidth - w) \/ 2; break;");
document.writeln("	    case \"r\": p.x += el.offsetWidth - w; break;");
document.writeln("	    case \"l\": break; \/\/ already there");
document.writeln("	}");
document.writeln("	this.showAt(p.x, p.y);");
document.writeln("};");
document.writeln("");
document.writeln("\/** Customizes the date format. *\/");
document.writeln("Calendar.prototype.setDateFormat = function (str) {");
document.writeln("	this.dateFormat = str;");
document.writeln("};");
document.writeln("");
document.writeln("\/** Customizes the tooltip date format. *\/");
document.writeln("Calendar.prototype.setTtDateFormat = function (str) {");
document.writeln("	this.ttDateFormat = str;");
document.writeln("};");
document.writeln("");
document.writeln("\/**");
document.writeln(" *  Tries to identify the date represented in a string.  If successful it also");
document.writeln(" *  calls this.setDate which moves the calendar to the given date.");
document.writeln(" *\/");
document.writeln("Calendar.prototype.parseDate = function (str, fmt) {");
document.writeln("	var y = 0;");
document.writeln("	var m = -1;");
document.writeln("	var d = 0;");
document.writeln("	var a = str.split(\/\\W+\/);");
document.writeln("	if (!fmt) {");
document.writeln("		fmt = this.dateFormat;");
document.writeln("	}");
document.writeln("	var b = fmt.split(\/\\W+\/);");
document.writeln("	var i = 0, j = 0;");
document.writeln("	for (i = 0; i < a.length; ++i) {");
document.writeln("		if (b[i] == \"D\" || b[i] == \"DD\") {");
document.writeln("			continue;");
document.writeln("		}");
document.writeln("		if (b[i] == \"d\" || b[i] == \"dd\") {");
document.writeln("			d = parseInt(a[i], 10);");
document.writeln("		}");
document.writeln("		if (b[i] == \"m\" || b[i] == \"mm\") {");
document.writeln("			m = parseInt(a[i], 10) - 1;");
document.writeln("		}");
document.writeln("		if ((b[i] == \"y\") || (b[i] == \"yy\")) {");
document.writeln("			y = parseInt(a[i], 10);");
document.writeln("			(y < 100) && (y += (y > 29) ? 1900 : 2000);");
document.writeln("		}");
document.writeln("		if (b[i] == \"M\" || b[i] == \"MM\") {");
document.writeln("			for (j = 0; j < 12; ++j) {");
document.writeln("				if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; }");
document.writeln("			}");
document.writeln("		}");
document.writeln("	}");
document.writeln("	if (y != 0 && m != -1 && d != 0) {");
document.writeln("		this.setDate(new Date(y, m, d));");
document.writeln("		return;");
document.writeln("	}");
document.writeln("	y = 0; m = -1; d = 0;");
document.writeln("	for (i = 0; i < a.length; ++i) {");
document.writeln("		if (a[i].search(\/[a-zA-Z]+\/) != -1) {");
document.writeln("			var t = -1;");
document.writeln("			for (j = 0; j < 12; ++j) {");
document.writeln("				if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; }");
document.writeln("			}");
document.writeln("			if (t != -1) {");
document.writeln("				if (m != -1) {");
document.writeln("					d = m+1;");
document.writeln("				}");
document.writeln("				m = t;");
document.writeln("			}");
document.writeln("		} else if (parseInt(a[i], 10) <= 12 && m == -1) {");
document.writeln("			m = a[i]-1;");
document.writeln("		} else if (parseInt(a[i], 10) > 31 && y == 0) {");
document.writeln("			y = parseInt(a[i], 10);");
document.writeln("			(y < 100) && (y += (y > 29) ? 1900 : 2000);");
document.writeln("		} else if (d == 0) {");
document.writeln("			d = a[i];");
document.writeln("		}");
document.writeln("	}");
document.writeln("	if (y == 0) {");
document.writeln("		var today = new Date();");
document.writeln("		y = today.getFullYear();");
document.writeln("	}");
document.writeln("	if (m != -1 && d != 0) {");
document.writeln("		this.setDate(new Date(y, m, d));");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("Calendar.prototype.hideShowCovered = function () {");
document.writeln("	function getStyleProp(obj, style){");
document.writeln("		var value = obj.style[style];");
document.writeln("		if (!value) {");
document.writeln("			if (document.defaultView && typeof (document.defaultView.getComputedStyle) == \"function\") { \/\/ Gecko, W3C");
document.writeln("				value = document.defaultView.");
document.writeln("					getComputedStyle(obj, \"\").getPropertyValue(style);");
document.writeln("			} else if (obj.currentStyle) { \/\/ IE");
document.writeln("				value = obj.currentStyle[style];");
document.writeln("			} else {");
document.writeln("				value = obj.style[style];");
document.writeln("			}");
document.writeln("		}");
document.writeln("		return value;");
document.writeln("	};");
document.writeln("");
document.writeln("	var tags = new Array(\"applet\", \"iframe\", \"select\");");
document.writeln("	var el = this.element;");
document.writeln("");
document.writeln("	var p = Calendar.getAbsolutePos(el);");
document.writeln("	var EX1 = p.x;");
document.writeln("	var EX2 = el.offsetWidth + EX1;");
document.writeln("	var EY1 = p.y;");
document.writeln("	var EY2 = el.offsetHeight + EY1;");
document.writeln("");
document.writeln("	for (var k = tags.length; k > 0; ) {");
document.writeln("		var ar = document.getElementsByTagName(tags[--k]);");
document.writeln("		var cc = null;");
document.writeln("");
document.writeln("		for (var i = ar.length; i > 0;) {");
document.writeln("			cc = ar[--i];");
document.writeln("");
document.writeln("			p = Calendar.getAbsolutePos(cc);");
document.writeln("			var CX1 = p.x;");
document.writeln("			var CX2 = cc.offsetWidth + CX1;");
document.writeln("			var CY1 = p.y;");
document.writeln("			var CY2 = cc.offsetHeight + CY1;");
document.writeln("");
document.writeln("			if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {");
document.writeln("				if (!cc.__msh_save_visibility) {");
document.writeln("					cc.__msh_save_visibility = getStyleProp(cc, \"visibility\");");
document.writeln("				}");
document.writeln("				cc.style.visibility = cc.__msh_save_visibility;");
document.writeln("			} else {");
document.writeln("				if (!cc.__msh_save_visibility) {");
document.writeln("					cc.__msh_save_visibility = getStyleProp(cc, \"visibility\");");
document.writeln("				}");
document.writeln("				cc.style.visibility = \"hidden\";");
document.writeln("			}");
document.writeln("		}");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/** Internal function; it displays the bar with the names of the weekday. *\/");
document.writeln("Calendar.prototype._displayWeekdays = function () {");
document.writeln("	var MON = this.mondayFirst ? 0 : 1;");
document.writeln("	var SUN = this.mondayFirst ? 6 : 0;");
document.writeln("	var SAT = this.mondayFirst ? 5 : 6;");
document.writeln("	var cell = this.firstdayname;");
document.writeln("	for (var i = 0; i < 7; ++i) {");
document.writeln("		cell.className = \"day name\";");
document.writeln("		if (!i) {");
document.writeln("			cell.ttip = this.mondayFirst ? Calendar._TT[\"SUN_FIRST\"] : Calendar._TT[\"MON_FIRST\"];");
document.writeln("			cell.navtype = 100;");
document.writeln("			cell.calendar = this;");
document.writeln("			Calendar._add_evs(cell);");
document.writeln("		}");
document.writeln("		if (i == SUN || i == SAT) {");
document.writeln("			Calendar.addClass(cell, \"weekend\");");
document.writeln("		}");
document.writeln("		cell.firstChild.data = Calendar._DN3[i + 1 - MON];");
document.writeln("		cell = cell.nextSibling;");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/** Internal function.  Hides all combo boxes that might be displayed. *\/");
document.writeln("Calendar.prototype._hideCombos = function () {");
document.writeln("	this.monthsCombo.style.display = \"none\";");
document.writeln("	this.yearsCombo.style.display = \"none\";");
document.writeln("};");
document.writeln("");
document.writeln("\/** Internal function.  Starts dragging the element. *\/");
document.writeln("Calendar.prototype._dragStart = function (ev) {");
document.writeln("	if (this.dragging) {");
document.writeln("		return;");
document.writeln("	}");
document.writeln("	this.dragging = true;");
document.writeln("	var posX;");
document.writeln("	var posY;");
document.writeln("	if (Calendar.is_ie) {");
document.writeln("		posY = window.event.clientY + document.body.scrollTop;");
document.writeln("		posX = window.event.clientX + document.body.scrollLeft;");
document.writeln("	} else {");
document.writeln("		posY = ev.clientY + window.scrollY;");
document.writeln("		posX = ev.clientX + window.scrollX;");
document.writeln("	}");
document.writeln("	var st = this.element.style;");
document.writeln("	this.xOffs = posX - parseInt(st.left);");
document.writeln("	this.yOffs = posY - parseInt(st.top);");
document.writeln("	with (Calendar) {");
document.writeln("		addEvent(document, \"mousemove\", calDragIt);");
document.writeln("		addEvent(document, \"mouseover\", stopEvent);");
document.writeln("		addEvent(document, \"mouseup\", calDragEnd);");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/\/ BEGIN: DATE OBJECT PATCHES");
document.writeln("");
document.writeln("\/** Adds the number of days array to the Date object. *\/");
document.writeln("Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31);");
document.writeln("");
document.writeln("\/** Constants used for time computations *\/");
document.writeln("Date.SECOND = 1000 \/* milliseconds *\/;");
document.writeln("Date.MINUTE = 60 * Date.SECOND;");
document.writeln("Date.HOUR   = 60 * Date.MINUTE;");
document.writeln("Date.DAY    = 24 * Date.HOUR;");
document.writeln("Date.WEEK   =  7 * Date.DAY;");
document.writeln("");
document.writeln("\/** Returns the number of days in the current month *\/");
document.writeln("Date.prototype.getMonthDays = function(month) {");
document.writeln("	var year = this.getFullYear();");
document.writeln("	if (typeof month == \"undefined\") {");
document.writeln("		month = this.getMonth();");
document.writeln("	}");
document.writeln("	if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) {");
document.writeln("		return 29;");
document.writeln("	} else {");
document.writeln("		return Date._MD[month];");
document.writeln("	}");
document.writeln("};");
document.writeln("");
document.writeln("\/** Returns the number of the week.  The algorithm was \"stolen\" from PPK\'s");
document.writeln(" * website, hope it\'s correct :) http:\/\/www.xs4all.nl\/~ppk\/js\/week.html *\/");
document.writeln("Date.prototype.getWeekNumber = function() {");
document.writeln("	var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);");
document.writeln("	var then = new Date(this.getFullYear(), 0, 1, 0, 0, 0);");
document.writeln("	var time = now - then;");
document.writeln("	var day = then.getDay();");
document.writeln("	(day > 3) && (day -= 4) || (day += 3);");
document.writeln("	return Math.round(((time \/ Date.DAY) + day) \/ 7);");
document.writeln("};");
document.writeln("");
document.writeln("\/** Checks dates equality (ignores time) *\/");
document.writeln("Date.prototype.equalsTo = function(date) {");
document.writeln("	return ((this.getFullYear() == date.getFullYear()) &&");
document.writeln("		(this.getMonth() == date.getMonth()) &&");
document.writeln("		(this.getDate() == date.getDate()));");
document.writeln("};");
document.writeln("");
document.writeln("\/** Prints the date in a string according to the given format. *\/");
document.writeln("Date.prototype.print = function (frm) {");
document.writeln("	var str = new String(frm);");
document.writeln("	var m = this.getMonth();");
document.writeln("	var d = this.getDate();");
document.writeln("	var y = this.getFullYear();");
document.writeln("	var wn = this.getWeekNumber();");
document.writeln("	var w = this.getDay();");
document.writeln("	var s = new Array();");
document.writeln("	s[\"d\"] = d;");
document.writeln("	s[\"dd\"] = (d < 10) ? (\"0\" + d) : d;");
document.writeln("	s[\"m\"] = 1+m;");
document.writeln("	s[\"mm\"] = (m < 9) ? (\"0\" + (1+m)) : (1+m);");
document.writeln("	s[\"y\"] = y;");
document.writeln("	s[\"yy\"] = new String(y).substr(2, 2);");
document.writeln("	s[\"w\"] = wn;");
document.writeln("	s[\"ww\"] = (wn < 10) ? (\"0\" + wn) : wn;");
document.writeln("	with (Calendar) {");
document.writeln("		s[\"D\"] = _DN3[w];");
document.writeln("		s[\"DD\"] = _DN[w];");
document.writeln("		s[\"M\"] = _MN3[m];");
document.writeln("		s[\"MM\"] = _MN[m];");
document.writeln("	}");
document.writeln("	var re = \/(.*)(\\W|^)(d|dd|m|mm|y|yy|MM|M|DD|D|w|ww)(\\W|$)(.*)\/;");
document.writeln("	while (re.exec(str) != null) {");
document.writeln("		str = RegExp.$1 + RegExp.$2 + s[RegExp.$3] + RegExp.$4 + RegExp.$5;");
document.writeln("	}");
document.writeln("	return str;");
document.writeln("};");
document.writeln("");
document.writeln("\/\/ END: DATE OBJECT PATCHES");
document.writeln("");
document.writeln("\/\/ global object that remembers the calendar");
document.writeln("window.calendar = null;");
document.writeln("");
document.writeln(" <\/script>");
document.writeln("  <script type=\"text\/javascript\" >");
document.writeln("\/\/ ** Translated by ATang ** I18N");
document.writeln("Calendar._DN = new Array");
document.writeln("(\"日\",");
document.writeln(" \"一\",");
document.writeln(" \"二\",");
document.writeln(" \"三\",");
document.writeln(" \"四\",");
document.writeln(" \"五\",");
document.writeln(" \"六\",");
document.writeln(" \"日\");");
document.writeln("Calendar._MN = new Array");
document.writeln("(\"一月\",");
document.writeln(" \"二月\",");
document.writeln(" \"三月\",");
document.writeln(" \"四月\",");
document.writeln(" \"五月\",");
document.writeln(" \"六月\",");
document.writeln(" \"七月\",");
document.writeln(" \"八月\",");
document.writeln(" \"九月\",");
document.writeln(" \"十月\",");
document.writeln(" \"十一月\",");
document.writeln(" \"十二月\");");
document.writeln("");
document.writeln("\/\/ tooltips");
document.writeln("Calendar._TT = {};");
document.writeln("Calendar._TT[\"TOGGLE\"] = \"切换周开始的一天\";");
document.writeln("Calendar._TT[\"PREV_YEAR\"] = \"上一年 (按住出菜单)\";");
document.writeln("Calendar._TT[\"PREV_MONTH\"] = \"上一月 (按住出菜单)\";");
document.writeln("Calendar._TT[\"GO_TODAY\"] = \"到今日\";");
document.writeln("Calendar._TT[\"NEXT_MONTH\"] = \"下一月 (按住出菜单)\";");
document.writeln("Calendar._TT[\"NEXT_YEAR\"] = \"下一年 (按住出菜单)\";");
document.writeln("Calendar._TT[\"SEL_DATE\"] = \"选择日期\";");
document.writeln("Calendar._TT[\"DRAG_TO_MOVE\"] = \"拖动\";");
document.writeln("Calendar._TT[\"PART_TODAY\"] = \" (今日)\";");
document.writeln("Calendar._TT[\"MON_FIRST\"] = \"首先显示星期一\";");
document.writeln("Calendar._TT[\"SUN_FIRST\"] = \"首先显示星期日\";");
document.writeln("Calendar._TT[\"CLOSE\"] = \"关闭\";");
document.writeln("Calendar._TT[\"TODAY\"] = \"今日\";");
document.writeln("");
document.writeln("\/\/ date formats");
document.writeln("Calendar._TT[\"DEF_DATE_FORMAT\"] = \"y-mm-dd\";");
document.writeln("Calendar._TT[\"TT_DATE_FORMAT\"] = \"D, M d\";");
document.writeln("");
document.writeln("Calendar._TT[\"WK\"] = \"周\";");
document.writeln("");
document.writeln(" <\/script>");
document.writeln("   <script type=\"text\/javascript\">");
document.writeln("var oldLink = null;");
document.writeln("\/\/ code to change the active stylesheet");
document.writeln("function setActiveStyleSheet(link, title) {");
document.writeln("  var i, a, main;");
document.writeln("  for(i=0; (a = document.getElementsByTagName(\"link\")[i]); i++) {");
document.writeln("    if(a.getAttribute(\"rel\").indexOf(\"style\") != -1 && a.getAttribute(\"title\")) {");
document.writeln("      a.disabled = true;");
document.writeln("      if(a.getAttribute(\"title\") == title) a.disabled = false;");
document.writeln("    }");
document.writeln("  }");
document.writeln("  if (oldLink) oldLink.style.fontWeight = \'normal\';");
document.writeln("  oldLink = link;");
document.writeln("  link.style.fontWeight = \'bold\';");
document.writeln("  return false;");
document.writeln("}");
document.writeln("");
document.writeln("\/\/ This function gets called when the end-user clicks on some date.");
document.writeln("function selected(cal, date) {");
document.writeln("  cal.sel.value = date; \/\/ just update the date in the input field.");
document.writeln("  if (cal.dateClicked && (cal.sel.id == \"sel1\" || cal.sel.id == \"sel3\"))");
document.writeln("    \/\/ if we add this call we close the calendar on single-click.");
document.writeln("    \/\/ just to exemplify both cases, we are using this only for the 1st");
document.writeln("    \/\/ and the 3rd field, while 2nd and 4th will still require double-click.");
document.writeln("    cal.callCloseHandler();");
document.writeln("}");
document.writeln("");
document.writeln("\/\/ And this gets called when the end-user clicks on the _selected_ date,");
document.writeln("\/\/ or clicks on the \"Close\" button.  It just hides the calendar without");
document.writeln("\/\/ destroying it.");
document.writeln("function closeHandler(cal) {");
document.writeln("  cal.hide();                        \/\/ hide the calendar");
document.writeln("}");
document.writeln("");
document.writeln("\/\/ This function shows the calendar under the element having the given id.");
document.writeln("\/\/ It takes care of catching \"mousedown\" signals on document and hiding the");
document.writeln("\/\/ calendar if the click was outside.");
document.writeln("function showCalendar(id, format) {");
document.writeln("  var el = document.getElementById(id);");
document.writeln("  if (calendar != null) {");
document.writeln("    \/\/ we already have some calendar created");
document.writeln("    calendar.hide();                 \/\/ so we hide it first.");
document.writeln("  } else {");
document.writeln("    \/\/ first-time call, create the calendar.");
document.writeln("    var cal = new Calendar(false, null, selected, closeHandler);");
document.writeln("    \/\/ uncomment the following line to hide the week numbers");
document.writeln("    \/\/ cal.weekNumbers = false;");
document.writeln("    calendar = cal;                  \/\/ remember it in the global var");
document.writeln("    cal.setRange(1900, 2070);        \/\/ min\/max year allowed.");
document.writeln("    cal.create();");
document.writeln("  }");
document.writeln("  calendar.setDateFormat(format);    \/\/ set the specified date format");
document.writeln("  calendar.parseDate(el.value);      \/\/ try to parse the text in field");
document.writeln("  calendar.sel = el;                 \/\/ inform it what input field we use");
document.writeln("");
document.writeln("  \/\/ the reference element that we pass to showAtElement is the button that");
document.writeln("  \/\/ triggers the calendar.  In this example we align the calendar bottom-right");
document.writeln("  \/\/ to the button.");
document.writeln("  calendar.showAtElement(el.nextSibling, \"Br\");        \/\/ show the calendar");
document.writeln("");
document.writeln("  return false;");
document.writeln("}");
document.writeln("");
document.writeln("var MINUTE = 60 * 1000;");
document.writeln("var HOUR = 60 * MINUTE;");
document.writeln("var DAY = 24 * HOUR;");
document.writeln("var WEEK = 7 * DAY;");
document.writeln("");
document.writeln("\/\/ If this handler returns true then the \"date\" given as");
document.writeln("\/\/ parameter will be disabled.  In this example we enable");
document.writeln("\/\/ only days within a range of 10 days from the current");
document.writeln("\/\/ date.");
document.writeln("\/\/ You can use the functions date.getFullYear() -- returns the year");
document.writeln("\/\/ as 4 digit number, date.getMonth() -- returns the month as 0..11,");
document.writeln("\/\/ and date.getDate() -- returns the date of the month as 1..31, to");
document.writeln("\/\/ make heavy calculations here.  However, beware that this function");
document.writeln("\/\/ should be very fast, as it is called for each day in a month when");
document.writeln("\/\/ the calendar is (re)constructed.");
document.writeln("function isDisabled(date) {");
document.writeln("  var today = new Date();");
document.writeln("  return (Math.abs(date.getTime() - today.getTime()) \/ DAY) > 10;");
document.writeln("}");
document.writeln("");
document.writeln("function flatSelected(cal, date) {");
document.writeln("  var el = document.getElementById(\"preview\");");
document.writeln("  el.innerHTML = date;");
document.writeln("}");
document.writeln("");
document.writeln("function showFlatCalendar() {");
document.writeln("  var parent = document.getElementById(\"display\");");
document.writeln("");
document.writeln("  \/\/ construct a calendar giving only the \"selected\" handler.");
document.writeln("  var cal = new Calendar(false, null, flatSelected);");
document.writeln("");
document.writeln("  \/\/ hide week numbers");
document.writeln("  cal.weekNumbers = false;");
document.writeln("");
document.writeln("  \/\/ We want some dates to be disabled; see function isDisabled above");
document.writeln("  cal.setDisabledHandler(isDisabled);");
document.writeln("  cal.setDateFormat(\"DD, M d\");");
document.writeln("");
document.writeln("  \/\/ this call must be the last as it might use data initialized above; if");
document.writeln("  \/\/ we specify a parent, as opposite to the \"showCalendar\" function above,");
document.writeln("  \/\/ then we create a flat calendar -- not popup.  Hidden, though, but...");
document.writeln("  cal.create(parent);");
document.writeln("");
document.writeln("  \/\/ ... we can show it here.");
document.writeln("  cal.show();");
document.writeln("}");
document.writeln(" <\/script>");